<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索引擎工作原理 - 爬虫索引大揭秘</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
            color: #333;
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
            overflow: hidden;
        }
        
        header {
            background: #4285f4;
            color: white;
            padding: 25px;
            text-align: center;
        }
        
        h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
        }
        
        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
        }
        
        .intro {
            padding: 25px;
            text-align: center;
            line-height: 1.6;
            font-size: 1.1rem;
            background: #f8f9fa;
        }
        
        .flow-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            padding: 20px;
            gap: 20px;
        }
        
        .step {
            width: 220px;
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            cursor: pointer;
        }
        
        .step:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
        }
        
        .step-header {
            padding: 15px;
            text-align: center;
            color: white;
            font-weight: bold;
        }
        
        .step-1 .step-header { background: #EA4335; }
        .step-2 .step-header { background: #FBBC05; }
        .step-3 .step-header { background: #34A853; }
        .step-4 .step-header { background: #4285F4; }
        
        .step-icon {
            font-size: 2.5rem;
            margin: 15px 0;
            text-align: center;
        }
        
        .step-content {
            padding: 15px;
            text-align: center;
            min-height: 120px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .step-title {
            font-weight: bold;
            margin-bottom: 10px;
            font-size: 1.1rem;
        }
        
        .visualization {
            padding: 30px;
            background: #f8f9fa;
            border-top: 1px solid #eee;
            min-height: 500px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .viz-container {
            width: 100%;
            max-width: 900px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            min-height: 400px;
            position: relative;
        }
        
        .controls {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 20px;
            flex-wrap: wrap;
        }
        
        button {
            padding: 12px 25px;
            border: none;
            border-radius: 50px;
            background: #4285f4;
            color: white;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 3px 10px rgba(66, 133, 244, 0.3);
        }
        
        button:hover {
            background: #3367d6;
            transform: translateY(-2px);
        }
        
        .search-demo {
            width: 100%;
            max-width: 600px;
            margin: 20px auto;
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .search-box {
            display: flex;
            margin-bottom: 20px;
        }
        
        .search-box input {
            flex: 1;
            padding: 12px 15px;
            border: 2px solid #ddd;
            border-radius: 50px 0 0 50px;
            font-size: 1rem;
        }
        
        .search-box button {
            border-radius: 0 50px 50px 0;
        }
        
        .results {
            text-align: left;
        }
        
        .result-item {
            padding: 10px;
            border-bottom: 1px solid #eee;
            transition: background-color 0.3s;
        }
        
        .result-item:hover {
            background-color: #f9f9f9;
        }
        
        .result-title {
            color: #1a0dab;
            font-weight: bold;
        }
        
        .result-url {
            color: #006621;
            font-size: 0.9rem;
        }
        
        .highlight {
            background: yellow;
            padding: 2px 0;
        }
        
        .spider {
            font-size: 2rem;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
        }
        
        .web-page {
            position: absolute;
            width: 80px;
            height: 100px;
            background: #f1f3f4;
            border: 1px solid #ddd;
            border-radius: 5px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            text-align: center;
            padding: 5px;
            transition: all 0.5s ease;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .web-page.small {
            width: 60px;
            height: 80px;
            font-size: 0.7rem;
        }
        
        .database {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
            align-items: center;
            min-height: 200px;
            position: relative;
        }
        
        .data-item {
            background: #f1f3f4;
            padding: 8px 15px;
            border-radius: 20px;
            font-size: 0.9rem;
            transition: all 0.5s ease;
            position: absolute;
        }
        
        .sorting-demo {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .result-card {
            background: white;
            border: 1px solid #ddd;
            border-radius: 5px;
            padding: 10px;
            display: flex;
            align-items: center;
            transition: all 0.5s ease;
        }
        
        .rank {
            font-size: 1.5rem;
            font-weight: bold;
            margin-right: 15px;
            width: 30px;
            text-align: center;
            color: #4285f4;
        }
        
        .page-info {
            flex: 1;
        }
        
        .active {
            border: 3px solid #4285f4;
            transform: scale(1.05);
        }
        
        .crawling {
            animation: crawl 8s infinite linear;
        }
        
        @keyframes crawl {
            0% { left: -50px; }
            100% { left: 850px; }
        }
        
        /* 第二步动画优化 */
        .storage-animation {
            display: flex;
            height: 300px;
            position: relative;
        }
        
        .web-pages-container {
            width: 40%;
            position: relative;
        }
        
        .database-container {
            width: 60%;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .database-icon {
            font-size: 5rem;
            color: #FBBC05;
            position: relative;
            z-index: 2;
        }
        
        .data-particle {
            position: absolute;
            background: #34A853;
            color: white;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 0.8rem;
            opacity: 0;
            z-index: 3;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        
        .moving-to-db {
            animation: moveToDB 2s forwards;
        }
        
        @keyframes moveToDB {
            0% {
                opacity: 1;
                transform: scale(1);
            }
            50% {
                opacity: 1;
            }
            100% {
                opacity: 0;
                transform: scale(0.5) translate(150px, -20px);
            }
        }
        
        .stored-item {
            position: absolute;
            background: #f1f3f4;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 0.8rem;
            opacity: 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .appear-in-db {
            animation: appearInDB 1s forwards;
        }
        
        @keyframes appearInDB {
            0% {
                opacity: 0;
                transform: scale(0.5);
            }
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }
        
        .storing {
            animation: store 3s forwards;
        }
        
        @keyframes store {
            0% { transform: scale(1); opacity: 1; }
            50% { transform: scale(0.5); opacity: 0.5; }
            100% { transform: scale(1); opacity: 1; top: 100px; left: 200px; }
        }
        
        .sorting {
            animation: sort 2s forwards;
        }
        
        @keyframes sort {
            0% { transform: translateY(0); }
            100% { transform: translateY(var(--sort-pos)); }
        }
        
        footer {
            text-align: center;
            padding: 20px;
            color: #666;
            font-size: 0.9rem;
            background: #f8f9fa;
            border-top: 1px solid #eee;
        }
        
        @media (max-width: 768px) {
            .step {
                width: 100%;
                max-width: 300px;
            }
            
            .flow-container {
                flex-direction: column;
                align-items: center;
            }
            
            .storage-animation {
                flex-direction: column;
                height: 500px;
            }
            
            .web-pages-container, .database-container {
                width: 100%;
                height: 50%;
            }
            
            @keyframes crawl {
                0% { left: -30px; }
                100% { left: 320px; }
            }
            
            @keyframes moveToDB {
                0% {
                    opacity: 1;
                    transform: scale(1);
                }
                50% {
                    opacity: 1;
                }
                100% {
                    opacity: 0;
                    transform: scale(0.5) translate(0, -100px);
                }
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1>搜索引擎工作原理</h1>
            <p class="subtitle">搜索大揭秘</p>
        </header>
        
        <div class="intro">
            <p>搜索引擎就像互联网世界的超级图书管理员，它能够快速从海量信息中找到你最需要的内容。让我们通过这个交互式演示了解它是如何工作的！</p>
        </div>
        
        <div class="flow-container">
            <div class="step step-1" onclick="showStep(1)">
                <div class="step-header">第一步</div>
                <div class="step-icon">
                    <i class="fas fa-spider"></i>
                </div>
                <div class="step-content">
                    <div class="step-title">爬取与发现</div>
                    <p>搜索引擎派出"蜘蛛"程序，在互联网上收集网页信息</p>
                </div>
            </div>
            
            <div class="step step-2" onclick="showStep(2)">
                <div class="step-header">第二步</div>
                <div class="step-icon">
                    <i class="fas fa-database"></i>
                </div>
                <div class="step-content">
                    <div class="step-title">存储与编目</div>
                    <p>将收集的信息整理并存储到巨大的数据库中</p>
                </div>
            </div>
            
            <div class="step step-3" onclick="showStep(3)">
                <div class="step-header">第三步</div>
                <div class="step-icon">
                    <i class="fas fa-sort-amount-down"></i>
                </div>
                <div class="step-content">
                    <div class="step-title">分析与排序</div>
                    <p>根据搜索请求，从数据库中找出最相关的结果并排序</p>
                </div>
            </div>
            
            <div class="step step-4" onclick="showStep(4)">
                <div class="step-header">第四步</div>
                <div class="step-icon">
                    <i class="fas fa-search"></i>
                </div>
                <div class="step-content">
                    <div class="step-title">呈现结果</div>
                    <p>将排序后的结果以清晰的方式展示给用户</p>
                </div>
            </div>
        </div>
        
        <div class="visualization">
            <h2 id="viz-title">存储与编目过程</h2>
            <div class="viz-container" id="viz-container">
                <div class="storage-animation">
                    <div class="web-pages-container" id="web-pages-container">
                        <div class="web-page" style="top: 20px; left: 30px;">
                            <i class="fas fa-file-alt"></i>
                            <div>大熊猫</div>
                        </div>
                        <div class="web-page" style="top: 140px; left: 10px;">
                            <i class="fas fa-file-alt"></i>
                            <div>熊猫习性</div>
                        </div>
                        <div class="web-page" style="top: 80px; left: 100px;">
                            <i class="fas fa-file-alt"></i>
                            <div>熊猫保护</div>
                        </div>
                    </div>
                    
                    <div class="database-container">
                        <i class="fas fa-database database-icon"></i>
                        <div class="database-items" id="database-items">
                            <!-- 数据库中的项目将通过JavaScript动态添加 -->
                        </div>
                    </div>
                </div>
                
                <div style="margin-top: 20px;">
                    <p>搜索引擎将从网页中提取的关键信息存储到数据库中，以便快速检索：</p>
                    <ul style="text-align: left; margin-left: 20px; margin-top: 10px;">
                        <li>网页内容中的关键词和短语</li>
                        <li>网页的标题和描述</li>
                        <li>网页之间的链接关系</li>
                        <li>图片和视频的元数据</li>
                    </ul>
                </div>
            </div>
            
            <div class="controls">
                <button onclick="showStep(1)"><i class="fas fa-spider"></i> 爬取过程</button>
                <button onclick="showStep(2)"><i class="fas fa-database"></i> 存储过程</button>
                <button onclick="showStep(3)"><i class="fas fa-sort"></i> 排序过程</button>
                <button onclick="showStep(4)"><i class="fas fa-search"></i> 搜索演示</button>
                <button onclick="startStorageAnimation()"><i class="fas fa-play"></i> 播放存储动画</button>
            </div>
        </div>
        
        <footer>
            <p>交互式课堂展示 -  designed for you</p>
            <p>通过可视化方式理解搜索引擎基本原理</p>
        </footer>
    </div>

    <script>
        // 当前激活的步骤
        let activeStep = 2; // 默认显示第二步
        let animationInterval;
        
        // 示例网页数据
        const examplePages = [
            { 
                title: "大熊猫", 
                url: "https://example.com/panda", 
                content: "大熊猫是中国的国宝，生活在四川等地区...",
                keywords: ["大熊猫", "中国", "国宝", "四川", "保护动物"]
            },
            { 
                title: "熊猫习性", 
                url: "https://example.com/panda-habits", 
                content: "大熊猫主要以竹子为食，每天需要花费大量时间进食...",
                keywords: ["熊猫", "习性", "竹子", "饮食", "行为"]
            },
            { 
                title: "熊猫保护", 
                url: "https://example.com/panda-protection", 
                content: "中国建立了多个自然保护区来保护大熊猫的栖息地...",
                keywords: ["熊猫", "保护", "自然保护区", "栖息地", "濒危"]
            }
        ];
        
        // 显示指定步骤的详细可视化
        function showStep(stepNumber) {
            activeStep = stepNumber;
            updateActiveStepStyle();
            clearInterval(animationInterval);
            
            const vizContainer = document.getElementById('viz-container');
            const vizTitle = document.getElementById('viz-title');
            
            switch(stepNumber) {
                case 1:
                    vizTitle.textContent = "爬取与发现过程";
                    vizContainer.innerHTML = `
                        <h3><i class="fas fa-spider"></i> 网络爬虫的工作方式</h3>
                        <p>搜索引擎使用称为"蜘蛛"的程序自动浏览互联网，收集网页信息：</p>
                        <div style="border: 2px dashed #EA4335; border-radius: 10px; padding: 15px; margin: 20px 0; height: 150px; overflow: hidden; position: relative;">
                            <div class="spider crawling" id="spider">
                                <i class="fas fa-spider"></i>
                            </div>
                            <div class="web-page" style="top: 20px; left: 200px;" id="page1">
                                <i class="fas fa-file-alt"></i>
                                <div>大熊猫</div>
                            </div>
                            <div class="web-page" style="top: 50px; left: 400px;" id="page2">
                                <i class="fas fa-file-alt"></i>
                                <div>熊猫习性</div>
                            </div>
                            <div class="web-page" style="top: 80px; left: 600px;" id="page3">
                                <i class="fas fa-file-alt"></i>
                                <div>熊猫保护</div>
                            </div>
                            <div class="web-page" style="top: 30px; left: 800px;" id="page4">
                                <i class="fas fa-file-alt"></i>
                                <div>熊猫历史</div>
                            </div>
                            <p style="position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);">互联网</p>
                        </div>
                        <ul style="text-align: left; margin-left: 20px;">
                            <li>从已知的网页开始，跟踪链接到新页面</li>
                            <li>将页面内容带回搜索引擎的数据库</li>
                            <li>像一只真正的蜘蛛在网络上爬行</li>
                        </ul>
                    `;
                    break;
                    
                case 2:
                    vizTitle.textContent = "存储与编目过程";
                    vizContainer.innerHTML = `
                        <div class="storage-animation">
                            <div class="web-pages-container" id="web-pages-container">
                                <div class="web-page" style="top: 20px; left: 30px;">
                                    <i class="fas fa-file-alt"></i>
                                    <div>大熊猫</div>
                                </div>
                                <div class="web-page" style="top: 140px; left: 10px;">
                                    <i class="fas fa-file-alt"></i>
                                    <div>熊猫习性</div>
                                </div>
                                <div class="web-page" style="top: 80px; left: 100px;">
                                    <i class="fas fa-file-alt"></i>
                                    <div>熊猫保护</div>
                                </div>
                            </div>
                            
                            <div class="database-container">
                                <i class="fas fa-database database-icon"></i>
                                <div class="database-items" id="database-items">
                                    <!-- 数据库中的项目将通过JavaScript动态添加 -->
                                </div>
                            </div>
                        </div>
                        
                        <div style="margin-top: 20px;">
                            <p>搜索引擎将从网页中提取的关键信息存储到数据库中，以便快速检索：</p>
                            <ul style="text-align: left; margin-left: 20px; margin-top: 10px;">
                                <li>网页内容中的关键词和短语</li>
                                <li>网页的标题和描述</li>
                                <li>网页之间的链接关系</li>
                                <li>图片和视频的元数据</li>
                            </ul>
                        </div>
                    `;
                    break;
                    
                case 3:
                    vizTitle.textContent = "分析与排序过程";
                    vizContainer.innerHTML = `
                        <h3><i class="fas fa-sort-amount-down-alt"></i> 智能排序算法</h3>
                        <p>当用户搜索"大熊猫"时，搜索引擎从数据库中找到相关页面并按重要性排序：</p>
                        
                        <div class="sorting-demo" style="margin: 20px 0;">
                            <div class="result-card" id="result1">
                                <div class="rank">1</div>
                                <div class="page-info">
                                    <div class="result-title">大熊猫 - 百科全书</div>
                                    <div class="result-url">https://example.com/panda</div>
                                    <p>全面介绍大熊猫的页面，内容权威</p>
                                </div>
                                <div style="color: #34A853;">评分: 95</div>
                            </div>
                            
                            <div class="result-card" id="result2">
                                <div class="rank">2</div>
                                <div class="page-info">
                                    <div class="result-title">熊猫保护研究中心</div>
                                    <div class="result-url">https://example.com/panda-protection</div>
                                    <p>官方保护机构网站，信息准确</p>
                                </div>
                                <div style="color: #34A853;">评分: 88</div>
                            </div>
                            
                            <div class="result-card" id="result3">
                                <div class="rank">3</div>
                                <div class="page-info">
                                    <div class="result-title">大熊猫的习性与特征</div>
                                    <div class="result-url">https://example.com/panda-habits</div>
                                    <p>详细介绍大熊猫生活习性的页面</p>
                                </div>
                                <div style="color: #34A853;">评分: 85</div>
                            </div>
                            
                            <div class="result-card" id="result4">
                                <div class="rank">4</div>
                                <div class="page-info">
                                    <div class="result-title">大熊猫的历史演化</div>
                                    <div class="result-url">https://example.com/panda-history</div>
                                    <p>关于大熊猫进化历史的学术文章</p>
                                </div>
                                <div style="color: #34A853;">评分: 82</div>
                            </div>
                        </div>
                        
                        <div style="background: #FBBC05; color: black; padding: 15px; border-radius: 10px;">
                            <p><i class="fas fa-info-circle"></i> 排序考虑因素: 内容相关性、权威性、用户体验、新鲜度等</p>
                        </div>
                    `;
                    break;
                    
                case 4:
                    vizTitle.textContent = "搜索结果呈现";
                    vizContainer.innerHTML = `
                        <h3><i class="fas fa-search"></i> 搜索演示</h3>
                        <p>尝试搜索"大熊猫"，查看搜索引擎如何呈现结果：</p>
                        
                        <div class="search-demo">
                            <div class="search-box">
                                <input type="text" id="search-query" value="大熊猫" placeholder="输入搜索关键词...">
                                <button onclick="performSearch()"><i class="fas fa-search"></i> 搜索</button>
                            </div>
                            
                            <div class="results" id="search-results">
                                <p>点击"搜索"按钮查看结果</p>
                            </div>
                        </div>
                    `;
                    break;
            }
        }
        
        // 播放存储动画
        function startStorageAnimation() {
            if (activeStep !== 2) {
                showStep(2);
                // 给一点时间让DOM更新
                setTimeout(startStorageAnimation, 100);
                return;
            }
            
            const webPagesContainer = document.getElementById('web-pages-container');
            const databaseItems = document.getElementById('database-items');
            databaseItems.innerHTML = '';
            
            // 清除之前的动画元素
            document.querySelectorAll('.data-particle').forEach(el => el.remove());
            document.querySelectorAll('.stored-item').forEach(el => el.remove());
            
            // 为每个网页创建数据粒子
            examplePages.forEach((page, pageIndex) => {
                // 为每个关键词创建数据粒子
                page.keywords.forEach((keyword, keywordIndex) => {
                    // 创建数据粒子
                    const particle = document.createElement('div');
                    particle.className = 'data-particle';
                    particle.textContent = keyword;
                    particle.style.top = `${50 + pageIndex * 60}px`;
                    particle.style.left = `${80 + pageIndex * 40}px`;
                    
                    webPagesContainer.appendChild(particle);
                    
                    // 延迟启动动画
                    setTimeout(() => {
                        particle.classList.add('moving-to-db');
                        
                        // 动画结束后，在数据库中创建对应的存储项
                        setTimeout(() => {
                            particle.remove();
                            
                            const storedItem = document.createElement('div');
                            storedItem.className = 'stored-item';
                            storedItem.textContent = keyword;
                            
                            // 随机位置
                            const randomX = Math.random() * 200 - 100;
                            const randomY = Math.random() * 100 - 50;
                            storedItem.style.left = `calc(50% + ${randomX}px)`;
                            storedItem.style.top = `calc(50% + ${randomY}px)`;
                            
                            databaseItems.appendChild(storedItem);
                            
                            // 显示存储项
                            setTimeout(() => {
                                storedItem.classList.add('appear-in-db');
                            }, 50);
                            
                        }, 2000); // 与CSS动画时间匹配
                    }, keywordIndex * 600 + pageIndex * 2000);
                });
            });
        }
        
        // 更新激活步骤的样式
        function updateActiveStepStyle() {
            // 移除所有步骤的active样式
            document.querySelectorAll('.step').forEach(step => {
                step.classList.remove('active');
            });
            
            // 为当前激活的步骤添加active样式
            if (activeStep > 0) {
                document.querySelector(`.step-${activeStep}`).classList.add('active');
            }
        }
        
        // 执行搜索演示
        function performSearch() {
            const query = document.getElementById('search-query').value.trim();
            const resultsContainer = document.getElementById('search-results');
            
            if (!query) {
                resultsContainer.innerHTML = '<p style="color: #EA4335;">请输入搜索关键词</p>';
                return;
            }
            
            // 模拟搜索结果 - 使用之前步骤中的示例页面
            resultsContainer.innerHTML = `
                <div class="result-item">
                    <div class="result-title">大熊猫 - 百科全书</div>
                    <div class="result-url">https://example.com/panda</div>
                    <p>大熊猫是中国的国宝，生活在四川等地区。它们是熊科动物，主要以竹子为食。</p>
                </div>
                
                <div class="result-item">
                    <div class="result-title">熊猫保护研究中心</div>
                    <div class="result-url">https://example.com/panda-protection</div>
                    <p>中国建立了多个自然保护区来保护大熊猫的栖息地，防止这种珍稀物种灭绝。</p>
                </div>
                
                <div class="result-item">
                    <div class="result-title">大熊猫的习性与特征</div>
                    <div class="result-url">https://example.com/panda-habits</div>
                    <p>大熊猫主要以竹子为食，每天需要花费大量时间进食。它们通常是独居动物，有着独特的行为习性。</p>
                </div>
                
                <div class="result-item">
                    <div class="result-title">大熊猫的历史演化</div>
                    <div class="result-url">https://example.com/panda-history</div>
                    <p>大熊猫已经存在了至少800万年，是真正的活化石物种。它们经历了漫长的进化过程。</p>
                </div>
                
                <div class="result-item">
                    <div class="result-title">大熊猫研究最新进展</div>
                    <div class="result-url">https://example.com/panda-research</div>
                    <p>科学家们正在研究大熊猫的繁殖习性以帮助它们更好地繁衍，近期取得了重要突破。</p>
                </div>
            `;
            
            // 高亮显示搜索关键词
            const text = resultsContainer.innerHTML;
            const highlightedText = text.replace(new RegExp(query, 'gi'), match => 
                `<span class="highlight">${match}</span>`
            );
            resultsContainer.innerHTML = highlightedText;
        }
        
        // 初始化页面
        document.addEventListener('DOMContentLoaded', function() {
            // 默认显示第二步
            showStep(2);
            
            // 添加键盘事件支持
            document.addEventListener('keydown', function(e) {
                if (e.key === '1') showStep(1);
                if (e.key === '2') showStep(2);
                if (e.key === '3') showStep(3);
                if (e.key === '4') showStep(4);
                if (e.key === ' ') startStorageAnimation();
            });
        });
    </script>
</body>
</html>